<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * Class CreateChangesTable.
 */
class CreateChangesTable extends Migration
{
	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('changes', function(Blueprint $table) {
            $table->increments('id');
			$table->integer('user_id')->comment('用户id');
			$table->string('user_name',64)->comment('买家名称');
			$table->integer('shop_id')->comment('商铺id');
			$table->string('shop_name',64)->comment('店铺名称');
			$table->string('change_code',64)->comment('退单编号');
			$table->string('change_type',64)->comment('退货类型，0为退款，1为部分退货退款，2全部退货退款');
			$table->string('order_code',64)->comment('订单编号');
			$table->integer('order_id')->comment('订单id');
			$table->integer('status')->default('0')->comment('状态：0为申请，1为同意，2为拒绝');
			$table->decimal('change_money',10,2)->default('0.00')->comment('退款金额');
			$table->text('change_product')->comment('退款商品，json');
			$table->text('resason')->comment('退款/退货原因');
            $table->timestamps();
			$table->softDeletes();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('changes');
	}
}
